/*!
	* @Title: 店铺管理
	* @author 		naluv125@hotmail.com
	* @date 			2013-7-27 下午12:59:34   
	* @version    	V1.0
 */

Ext.define('MyDesktop.Tshop', {
    extend: 'Ext.ux.desktop.Module',

    requires: [
        'Bleext.abstract.GridForm'
    ],

    id:'tshop-win',

    init : function(){
        this.launcher = {
            text: '店铺管理',
            iconCls:'img_shopcart'
        };
    },

    createWindow : function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('tshop-win');
        if(!win){
        	var shop = this.buildShopModule();
            win = desktop.createWindow({
                id: 'tshop-win',
                title:'店铺管理',
                width:990 ,
                height:610,
                iconCls: 'img_shopcart',
                animCollapse:false,
                border:false,
                constrainHeader:true, //窗口顶部不能超过浏览器外界

                layout: 'fit',
                items: [shop]
            });
        }
        return win;
    },
    
    buildShopModule:function(){
    		var shopInst = Ext.create('Bleext.abstract.GridForm',{
    			pageLoad:true,
    			formColumnCount:4,
    			gridTitle : '查询结果',
    			formTitle:'店铺查询',
    		    loadGridUrl:BP+'shop/pageQueryTShops',
    		    addUrl:BP+'shop/insertTShop',
    			updateUrl:BP+'shop/updateTShop',
    			removeUrl:BP+'shop/removeTshop',
    		    
    			columnConfig: [  {header: 'ID', dataIndex: 'id', hideGrid: true, hideForm: 'add', hidden:true ,readOnly: true},
    			                 			 {header: '店铺编号', dataIndex: 'shopCode',allowBlank:false ,sortable:true, uneditable:true},
    			                 			 {header: '店铺名称', dataIndex: 'shopName',allowBlank:false},
    			                 			 {header: '店长编号',  dataIndex: 'shopOwner',vtype:'distcode'},
    			                 			 {header: '国家', dataIndex: 'shopCountry'},
    			                 			 {header: '城市', dataIndex: 'shopCity'}, 
    			                 			 {header: '店铺地址', dataIndex: 'shopAddr',width:172},
    			                 			 {header: '创建人', dataIndex: 'creator',hideForm:'all',hideGrid: true},
    			                 			 {header: '创建时间',dataIndex: 'createTime',hideForm:'all',width:172, type:'date',renderer: Ext.util.Format.dateRenderer('Y-m-d H:m:s')}],
    			                 			 
    			formConfig:[{xtype:'textfield', fieldLabel: '编号', name:'shopCode'},
    			            		  {xtype:'textfield', fieldLabel: '名称', name: 'shopName'},
    			            		  {xtype:'textfield', fieldLabel: '国家', name: 'shopCountry'},
    			            		  {xtype:'textfield', fieldLabel: '城市', name: 'shopCity'}]
    		});
    		return shopInst;
    }
});
